const express = require('express')
const router = express.Router()

// 导入图片分类的路由处理函数模块
const picture_handler = require('../router_handler/pictureClass')

// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入图片分类的schema
const { add_Class_schema,delete_Class_schema,get_Class_schema,update_Class_schema } = require('../schema/pictureClass')



// 获取图片分类的列表数据
router.get('/class', picture_handler.getPictureClass)

// 新增图片分类的路由
router.post('/addclass', expressJoi(add_Class_schema),picture_handler.addPictureClass)

// 删除图片分类的路由
router.get('/deleteclass/:id',expressJoi(delete_Class_schema), picture_handler.deleteClassById)

// 根据id获取图片分类数据
router.get('/class/:id', expressJoi(get_Class_schema),picture_handler.getPictureById)

// 更新图片分类的路由
router.post('/updateclass', expressJoi(update_Class_schema),picture_handler.updateClassById)

module.exports = router